package com.web.controller;

import com.web.common.responseResult.ResponseResult;
import com.web.common.vo.BrandSaleCounts;
import com.web.common.vo.CarSaleCounts;
import com.web.service.Task2Service;
import jakarta.websocket.server.PathParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * [一句话描述该类的功能]
 *
 * @author : [Lenovo]
 * @version : [v1.0]
 * @createTime : [2024/6/8 下午9:42]
 */
@RestController
@RequestMapping("/task2")
@Slf4j
public class Task2Controller {
    @Autowired
    private Task2Service task2Service;
    @GetMapping("/carSaleCounts")
    public ResponseResult<CarSaleCounts> getCarSaleCounts(@RequestParam("month")int month)
    {
        log.info("car_month:{}",month);
        CarSaleCounts carSaleCounts = task2Service.getCarSaleCounts(month);
        return ResponseResult.okResult(carSaleCounts);
    }
    @GetMapping("/brandSaleCounts")
    public ResponseResult<BrandSaleCounts> getBrandSaleCounts(@RequestParam("month")int month)
    {
        log.info("brand_month:{}",month);
        BrandSaleCounts brandSaleCounts = task2Service.getBrandSaleCounts( month);
        return ResponseResult.okResult(brandSaleCounts);
    }
}
